<template>
    <div>
        <!-- 进出站管理-出站登记 -->
        <div class="car-container">
            <el-row>
                <el-col :span="24">
                    <!--车辆基本信息S-->
                    <div class="left-choose lf">
                        <img src="../../assets/imgs/operation_bg_biaoti_default.png" alt="" class="lf"><div class="lf title">车辆基本信息</div>
                    </div>
                    <!--车辆基本信息E-->
                </el-col>
            </el-row>
            <div class="car-items" style="height: 100px">
                <!--<avue-form ref="form" v-model="carMessage" :option="option" class="yz-form " style="height: 100px"></avue-form>-->
                <el-form ref="form">
                    <el-col :span="4">
                        <el-form-item label="车牌号码" label-width="70px">
                            <el-autocomplete v-model="cardCodeTips" placeholder="" size="mini" :fetch-suggestions="querySearchCode"></el-autocomplete>
                        </el-form-item>
                    </el-col>
                    <el-form-item label="道路运输证号" label-width="68px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="roadNumbe" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="座位" label-width="60px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="cardStyle" style='width: 110px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="装备等级" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="grade" style='width: 120px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="技术等级" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="passenge" style='width: 120px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="审验有效期" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="examination" style='width: 120px;' size="mini" readonly></el-input>
                    </el-form-item>

                    <el-form-item label="业户名称" label-width="70px" class="lf">
                        <el-input v-model="lineNum" style='width: 135px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="标志牌号码" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="unitNumbe" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>

                    <el-form-item label="线路名称" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="operateName" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>

                    <el-form-item label="途径线路" label-width="80px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="deadline" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="配客站点" label-width="90px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="dueDate" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>

                </el-form>
            </div>
            <el-row>
                <el-col :span="24">
                    <!--出站登记信息S-->
                    <div class="left-choose lf">
                        <img src="../../assets/imgs/operation_bg_biaoti_default.png" alt="" class="lf"><div class="lf title">出站登记信息</div>
                    </div>
                    <!--出站登记信息E-->
                </el-col>
            </el-row>
            <div class="car-items" style="overflow: hidden;">
                <!--<avue-form ref="form" v-model="outLoginMess" :option="outLogin" class="yz-form" style="height: 100px"></avue-form>-->
                <el-form ref="form">

                    <el-form-item label="班次号" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="banClass" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="发车站" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="beginStation" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="终到站" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="endStation" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="班次种类" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="banClassStyle" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="发班时间" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="beginTime" style='width: 150px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="车上已有人数" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="carHasPeo" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="凭票人数" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="pinPeo" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="免票人数" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="freePeo" text="number" style='width: 130px;' size="mini"></el-input>
                    </el-form-item>
                    <el-form-item label="免票儿童数" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="freeChild" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="出站总人数" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="outPeo" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                   <!-- <el-form-item label="安检是否有效" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="screeEffective" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="行驶证有效性" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="driveEffective" style='width: 130px;' size="mini" readonly></el-input>
                    </el-form-item>-->

                    <el-col :span="4">
                        <el-form-item label="驾驶员姓名" label-width="70px" class="lf" style="margin-left: 20px;">
                            <el-autocomplete v-model="driveNames1" placeholder="" size="mini" :fetch-suggestions="queryCardCode"></el-autocomplete>
                        </el-form-item>
                    </el-col>
                    <el-form-item label="从业资格证号" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="newEmployment1" style='width: 160px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-col :span="4">
                        <el-form-item label="驾驶员姓名" label-width="70px" class="lf" style="margin-left: 20px;">
                            <el-autocomplete v-model="driveNames2" placeholder="" size="mini" :fetch-suggestions="queryCardCode"></el-autocomplete>
                        </el-form-item>
                    </el-col>
                    <el-form-item label="从业资格证号" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="newEmployment2" style='width: 160px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-col :span="4">
                        <el-form-item label="驾驶员姓名" label-width="70px" class="lf" style="margin-left: 20px;">
                            <el-autocomplete v-model="driveNames3" placeholder="" size="mini" :fetch-suggestions="queryCardCode"></el-autocomplete>
                        </el-form-item>
                    </el-col>
                    <el-form-item label="从业资格证号" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="newEmployment3" style='width: 160px;' size="mini" readonly></el-input>
                    </el-form-item>
                    <el-form-item label="备注" label-width="70px" class="lf" style="margin-left: 20px;">
                        <el-input v-model="beiZhu" style='width: 130px;' size="mini"></el-input>
                    </el-form-item>
                </el-form>
                <avue-form ref="form" style="width: 100%" v-model="outLoginMess" :option="outLogin" class="yz-form lf"></avue-form>

            </div>
            <button class="transport preserve rf" @click="safeMess"><i class="lf"></i><span class="lf">保存出站信息</span></button>
            <button class="transport read rf"><i class="lf"></i><span class="lf">读从业资格证</span></button>
            <button class="transport rf"><i class="lf"></i><span class="lf">读道路运输证</span></button>
        </div>

        <!--对应的查询数据-->
        <div class="bottom-container">
            <el-row>
                <el-col :span="24" class="choose-container">
                    <el-form ref="form">
                        <el-col :span="12">
                            <el-form-item label="">
                                <avue-form v-model="formDate" :option="showData" class="yz-form"></avue-form>
                            </el-form-item>
                        </el-col>
                        <el-col :span="4">
                            <el-form-item label="车牌号" label-width="100px">
                                <el-autocomplete v-model="comp" placeholder="" size="mini" :fetch-suggestions="querySearchComp"></el-autocomplete>
                            </el-form-item>
                        </el-col>
                    </el-form>

                    <button class="check-btn rf" @click="resetBtn">
                        <img src="../../assets/imgs/operation_btn_icon_chongzhi_default.png" alt="" class="btn-img">
                        重置</button>
                    <button class="check-btn rf" @click="searchBusList">
                        <img src="../../assets/imgs/operation_btn_icon_chaxun_default.png" alt="" class="btn-img">
                        查询</button>
                </el-col>
            </el-row>
            <!-- 数据表格 -->
            <el-row>
                <el-col :span="24">
                    <avue-crud @current-change="rowChange" @current-row-change="handleCurrentRowChange" :data="carData"  :page="page" :option="dataForm"></avue-crud>
                </el-col>
            </el-row>
        </div>
    </div>
</template>

<script>
    import "../../assets/js/jquery.js";
    // import TableData from "../../components/common/tableData";
    // import qs from "qs";

    const DIC = {
        VAILD: [{
            label: '否',
            value: 0,
        },
            {
                label: '是',
                value: 1,
            }],
        yesOrNo: [{
            label: '',
            value: 'true',
        }],
    };
    export default {
        data: function(){
            return {
                restaurants:[],
                cardRestaurants:[],
                carArr:[],
                carMessage:{},
                outLoginMess:{},
                formDate:{},//一般v-model的值默认是空对象
                option:{
                    column: [
                        {
                            label: "车牌号码",
                            prop: "carNumber",
                            span: 4
                        },
                        {
                            label: "道路运输证号",
                            prop: "roadNumber",
                            span: 4
                        },
                        {
                            label: "座位",
                            prop: "seat",
                            span: 4
                        },
                        {
                            label: "装备等级",
                            prop: "equipmentGrade",
                            span: 4
                        },
                        {
                            label: "技术等级",
                            prop: "industrialGrade",
                            span: 4
                        },
                        {
                            label: "审验有效期",
                            prop: "inspection",
                            span: 4
                        },
                        {
                            label: "业户名称",
                            prop: "businessName",
                            span: 4
                        },
                        {
                            label: "标志牌号码",
                            prop: "signNumber",
                            span: 4
                        },
                        {
                            label: "线路名称",
                            prop: "lineName",
                            span: 5
                        },
                        {
                            label: "途径线路",
                            prop: "routeLine",
                            span: 5
                        },
                        {
                            label: "配客站点",
                            prop: "pairingSite",
                            span: 5
                        },
                    ]
                },
                cardCodeTips: "",
                driveNames1: "",
                driveNames2: "",
                driveNames3: "",
                cardStyle: "",
                passenge: "",
                grade: "",
                lineNum: "",
                unitNumbe: "",
                roadNumbe: "",
                operateName: "",
                examination: "",
                deadline: "",
                dueDate: "",
                newEmployment1: '',
                newEmployment2: '',
                newEmployment3: '',
                banClass: "",
                beginStation: "",
                endStation: "",
                banClassStyle: "",
                beginTime: "",
                carHasPeo: "",
                pinPeo: "",
                freePeo: "",
                freeChild: "",
                outPeo: "",
                beiZhu: "",
                screeEffective: "",
                driveEffective: "",
                comp: "",
                currentRow:"",//点击的是当前的第几行
                outLogin:{
                    dicData:DIC,
                    column: [
                        /*{
                            label: "班次号",
                            prop: "classNumber",
                            span: 4
                        },
                        {
                            label: "发车站",
                            prop: "beginAddress",
                            span: 4
                        },
                        {
                            label: "终到站",
                            prop: "endAddress",
                            span: 4
                        },
                        {
                            label: "班次种类",
                            prop: "classStyle",
                            span: 4
                        },
                        {
                            label: "发班时间",
                            prop: "beginTime",
                            span: 4
                        },
                        {
                            label: "车上已有人数",
                            prop: "hasPeople",
                            span: 4
                        },
                        {
                            label: "业户名称",
                            prop: "businessName",
                            span: 4
                        },
                        {
                            label: "凭票人数",
                            prop: "signNumber",
                            span: 4
                        },
                        {
                            label: "线路名称",
                            prop: "ticketNumber",
                            span: 4
                        },
                        {
                            label: "免票人数",
                            prop: "freePeople",
                            span: 4
                        },
                        {
                            label: "免票儿童数",
                            prop: "freeChild",
                            span: 4
                        },
                        {
                            label: "出站总人数",
                            prop: "outAllPeople",
                            span: 4
                        },*/
                        {
                            label: "安检是否有效",
                            prop: "safe",
                            span: 5,
                            type: "switch",
                            dicData: 'VAILD',
                            hide: true,
                            valueDefault: 0
                        },
                        {
                            label: "行驶证有效性",
                            prop: "drive",
                            span: 5,
                            type: "switch",
                            dicData: 'VAILD',
                            hide: true,
                            valueDefault: 0
                        },
                        /*{
                            label: "驾驶员姓名",
                            prop: "driveName",
                            span: 4
                        },
                        {
                            label: "从业资格证号",
                            prop: "employment",
                            span: 4
                        },*/
                        {
                            label: "驾驶证有效性",
                            prop: "driverunValidity1",
                            span: 5,
                            type: "switch",
                            dicData: 'VAILD',
                            hide: true,
                            valueDefault: 0
                        },
                        /*{
                            label: "驾驶员姓名",
                            prop: "driveName1",
                            span: 4
                        },
                        {
                            label: "从业资格证号",
                            prop: "employment1",
                            span: 4
                        },*/
                        {
                            label: "驾驶证有效性",
                            prop: "driverunValidity2",
                            span: 5,
                            type: "switch",
                            dicData: 'VAILD',
                            hide: true,
                            valueDefault: 0
                        },
                        /*{
                            label: "驾驶员姓名",
                            prop: "driveName2",
                            span: 4
                        },
                        {
                            label: "从业资格证号",
                            prop: "employment2",
                            span: 4
                        },*/
                        {
                            label: "驾驶证有效性",
                            prop: "driverunValidity3",
                            span: 5,
                            type: "switch",
                            dicData: 'VAILD',
                            hide: true,
                            valueDefault: 0
                        },
                        {
                            label: "安检系好安全带",
                            prop: "lifeBelt",
                            span: 5,
                            type: "switch",
                            dicData: 'VAILD',
                            hide: true,
                            valueDefault: 0
                        },
                        {
                            label: "是否配载危险物品",
                            prop: "dangerous",
                            span: 5,
                            type: "switch",
                            dicData: 'VAILD',
                            hide: true,
                            valueDefault: 0
                        },
                        {
                            label: "是否超员",
                            prop: "overstaffed",
                            span: 5,
                            type: "switch",
                            dicData: 'VAILD',
                            hide: true,
                            valueDefault: 0
                        },
                        /*{
                            label: "备注",
                            prop: "remarks",
                            span: 6
                        },
                        {
                            label: "自动打印",
                            prop: "grade",
                            span: 6,
                            type: "checkbox",
                            dicData: 'yesOrNo'
                        }*/
                    ]
                },
                showData:{
                    labelWidth:110,
                    column: [{
                        label: "",
                        prop: "date",
                        type: "date"
                    }/*,
                        {
                            label: "车牌号",
                            prop: "carNum",
                        }*/
                    ]
                },
                carData:[],//数据展示的数组
                page: {
                    pageSizes: [10],//分页信息
                    total: 20,//总页数
                    currentPage: 1,//当前第几页
                    pageSize: 10,//每一页加载多少条数据
                },
                dataForm:{
                    page:true,
                    align:'center',
                    highlightCurrentRow:true,
                    addBtn:false,//是否添加按钮
                    delBtn:false,//是否添加删除按钮
                    editBtn:false,//是否添加编辑按钮
                    menu:false,//是否添加菜单按钮
                    column:[
                        {
                            sortable:true,
                            label:'打单时间',
                            prop:'bus_bill_print_time',
                        },
                        {
                            label:'线路',
                            prop:'line_name',
                        },
                        {
                            label:'时间',
                            prop:'bus_time',
                        },
                        {
                            label:'报班车牌',
                            prop:'vehino',
                        },
                        {
                            label:'顶班车牌',
                            prop:'baoban_vehino',
                        },
                        {
                            label:'本站',
                            prop:'people_count',
                        },
                        {
                            label:'免票儿童',
                            prop:'enfant_count',
                        },
                        {
                            label:'',
                            prop:'is_ot',
                        },
                        {
                            label:'班次号',
                            prop:'bus_id',
                        }
                    ]
                }
            };
        },
        methods:{
            getDriverList(){//获取出站登记-驾驶员列表
                this.postRequest("/sch/data/driver/listWithSpell").then(target => {
                    var tag = target.data;
                    // console.log(tag);
                    this.cardRestaurants = [];
                    for(var i=0;i<tag.length;i++){
                        this.cardRestaurants.push({"value":tag[i].name});

                    }
                });
            },
            //查询接口
            searchBusList(){
                console.log(this.formDate.date);
                var that = this;
                var checkDate = that.formDate.date;
                this.postRequest("/stationmanage/outbound/bus/buslist",{
                        filterRules: JSON.stringify([
                            {"field":"bus_date","op":"eq","value":checkDate === "" ? that.dateToString(new Date) : that.dateToString(checkDate)},
                            {"field":"bb.vehino","op":"eq","value":this.comp}
                            /*测试数据*/// {"field":"bus_date","op":"eq","value":"2018-08-27"},
                        ]),sort: 'bus_bill_print_time',order: 'desc',page: this.page.currentPage,rows: '10'
                }).then(target =>{
                    console.log(target);
                    var tag = target.data.list;
                    //页码大小
                    this.page.pageSize = target.data.pageSize;
                    //页码数
                    this.page.pageNumber = target.data.pageNumber;
                    //总页数
                    this.page.total = target.data.totalRow;
                    if(tag !== ''){
                        for(var i=0;i<tag.length;i++){
                            console.log(tag[i].is_ot);
                            console.log(this.dataForm.is_ot);

                            if(tag[i].is_ot === true){
                                tag[i].is_ot = '加';
                            }else{tag[i].is_ot = '';}
                        }
                        this.carData = tag;
                    }
                });
            },
            //重置接口
            resetBtn(){
                var that = this;
                var checkDate = that.formDate.date;
                this.postRequest("/stationmanage/outbound/bus/buslist",{
                    filterRules: JSON.stringify([ //that.checkDate == "" ? that.dateToString(new Date) : that.dateToString(that.checkDate)
                        {"field":"bus_date","op":"eq","value":checkDate === "" ? that.dateToString(new Date) : that.dateToString(checkDate)},
                        // {"field":"bus_date","op":"eq","value":"2018-08-27"},/*测试数据*/
                    ]),sort: 'bus_bill_print_time',order: 'desc',page: this.page.currentPage,rows: '10'
                }).then(target =>{
                    console.log("********");
                    console.log(target);
                    console.log("********");
                    var tag = target.data.list;
                    //页码大小
                    this.page.pageSize = target.data.pageSize;
                    //页码数
                    this.page.pageNumber = target.data.pageNumber;
                    //总页数
                    this.page.total = target.data.totalRow;
                    for(var i=0;i<tag.length;i++){
                        console.log(tag[i].is_ot);
                        console.log(this.dataForm.is_ot);

                        if(tag[i].is_ot){
                            tag[i].is_ot = '加';
                        }else{tag[i].is_ot = '';}
                    }
                    this.carData = tag;
                });
            },
            //获取车辆信息
            loadAll() {
                return [ ];
            },
            //获取车牌
            searchCode(){
                this.postRequest("/sch/data/bus_vehicle/listWithSpell")
                    .then(target => {
                        // console.log(target.data);
                        var tag = target.data;
                        this.restaurants = [];
                        for(var i=0;i<tag.length;i++){
                            // console.log(tag[i].vehi_no);
                            // console.log(this.loadAll.value);
                            this.restaurants.push({"value":tag[i].vehi_no});
                            this.carArr.push({"value":tag[i].vehi_no});
                        }
                    });
            },
            //获取焦点车牌号自动下拉提示
            querySearchCode(queryString, cb) {
                var restaurants = this.restaurants;
                var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
                // 调用 callback 返回建议列表的数据
                cb(results);
            },
            queryCardCode(queryString, cb) {
                var cardrestaurants = this.cardRestaurants;
                var results = queryString ? cardrestaurants.filter(this.createFilter(queryString)) : cardrestaurants;
                // 调用 callback 返回建议列表的数据
                cb(results);
            },
            querySearchComp(queryString, cb) {
                var carArrs = this.carArr;
                var results = queryString ? carArrs.filter(this.createFilter(queryString)) : carArrs;
                // 调用 callback 返回建议列表的数据
                cb(results);
            },
            createFilter(queryString) {
                return (restaurant) => {
                    return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
                };
            },
            getCardMess(){//根据车牌号读取相对应的车辆基本信息
                this.getRequest("/sch/data/bus_vehicle/info?vehino="+this.cardCodeTips)
                    .then(target => {
                        // console.log(target);
                        console.log(target.data);
                        var tag = target.data;
                        this.roadNumbe = tag.dao_lu_yun_shu_zheng_hao;//道路运输证号
                        this.cardStyle = tag.all_seat;//座位
                        this.grade = tag.ji_shu_deng_ji;//装备等级
                        this.passenge = tag.all_seat;//技术等级
                        this.examination = tag.shen_yan_you_xiao_qi;//审验有效期

                        this.lineNum = '后台暂时没返回';//业户名称
                        this.unitNumbe = '后台暂时没返回';//标志牌号码

                        this.operateName = tag.xian_lu_ming_cheng;//线路名称

                        this.deadline = tag.zhong_dian_shi_qu_tu_jing;//途径线路
                        this.dueDate = tag.pkzh;//配客站点
                        this.carHasPeo = tag.last_inbound_people_count;
                    });
            },
            handleCurrentRowChange(val){//点击行读取对应的出站登记信息
                console.log(val);
                console.log(val.bus_id);
                console.log(val.bus_date);
                // console.log(val.id);
                this.currentRow = val.bus_id;
                this.postRequest('/stationmanage/outbound/bus/businfo?bus_date='+val.bus_date+'&bus_id='+val.bus_id)
                    .then(target =>{
                        console.log(target.data);
                        var tag = target.data[1];
                        this.banClass = tag.bus_id;
                        this.beginStation = tag.org_name;
                        this.endStation = tag.end_station;
                        this.banClassStyle = tag.bus_type;
                        this.beginTime = tag.faban_time;
                        this.pinPeo = tag.people_count;
                        this.freeChild = tag.enfant_count;
                        this.outPeo = Number(tag.people_count) + Number(this.carHasPeo);
                    })
            },
            safeMess(){
                this.getRequest('/stationmanage/outbound/bus/add?busPlanOutBoundLog.bus_plan_id=1565439&busPlanOutBoundLog.jin_zhan_shi_jian=2018-08-31+10%3A08%3A07&busPlanOutBoundLog.vehi_no'+this.cardCodeTips+'&busPlanOutBoundLog.dao_lu_yun_shu_zheng_hao='+this.roadNumbe+'&busPlanOutBoundLog.zuo_wei='+this.cardStyle+'&busPlanOutBoundLog.zhuang_bei_deng_ji='+this.grade+'&busPlanOutBoundLog.ji_shu_deng_ji='+this.passenge+'&busPlanOutBoundLog.shen_yan_you_xiao_qi='+this.examination+'&busPlanOutBoundLog.ye_hu_ming_cheng='+this.lineNum+'&busPlanOutBoundLog.biao_zhi_pai_hao_ma='+this.unitNumbe+'&busPlanOutBoundLog.xian_lu_ming_cheng='+this.operateName+'&busPlanOutBoundLog.tu_jing_xian_lu='+this.deadline+'&busPlanOutBoundLog.pei_ke_zhan_dian='+this.dueDate+'&busPlanOutBoundLog.ban_ci_hao'+this.banClass+'&busPlanOutBoundLog.fa_che_zhan='+this.beginStation+'&busPlanOutBoundLog.zhong_dao_zhan='+this.endStation+'&busPlanOutBoundLog.ban_ci_zhong_lei='+this.banClassStyle+'&busPlanOutBoundLog.fa_ban_shi_jian='+this.beginTime+'&busPlanOutBoundLog.che_shang_yi_you_ren_shu='+this.carHasPeo+'&busPlanOutBoundLog.ben_zhan_ping_piao_ren_shu='+this.pinPeo+'&busPlanOutBoundLog.ben_zhan_mian_piao_ren_shu='+this.freePeo+'&busPlanOutBoundLog.ben_zhan_mian_piao_er_tong='+this.freeChild+'&busPlanOutBoundLog.chu_zhan_zhong_ren_shu='+this.outPeo+'&busPlanOutBoundLog.an_jian_shi_fou_you_xiao='+this.outLoginMess.safe+'&busPlanOutBoundLog.xing_shi_zheng_shi_fou_you_xiao='+this.outLoginMess.drive+'&busPlanOutBoundLog.jia_shi_yuan_1='+this.driveNames1+'&busPlanOutBoundLog.chong_ye_zhi_ge_zheng_hao_1='+this.newEmployment1+'&busPlanOutBoundLog.jia_shi_zheng_shi_fou_you_xiao_1='+this.outLoginMess.driverunValidity1+'&busPlanOutBoundLog.jia_shi_yuan_2='+this.driveNames2+'&busPlanOutBoundLog.chong_ye_zhi_ge_zheng_hao_2='+this.newEmployment2+'&busPlanOutBoundLog.jia_shi_zheng_shi_fou_you_xiao_2='+this.outLoginMess.driverunValidity2+'1&busPlanOutBoundLog.jia_shi_yuan_3='+this.driveNames3+'&busPlanOutBoundLog.chong_ye_zhi_ge_zheng_hao_3='+this.newEmployment3+'&busPlanOutBoundLog.jia_shi_zheng_shi_fou_you_xiao_3='+this.outLoginMess.driverunValidity3+'&busPlanOutBoundLog.shi_fou_ji_hao_an_quan_dai='+this.outLoginMess.lifeBelt+'&busPlanOutBoundLog.shi_fou_pei_zai_wei_xian_pin='+this.outLoginMess.dangerous+'&busPlanOutBoundLog.bei_zhu='+this.beiZhu+'&busPlanOutBoundLog.shi_fou_chao_yuan='+this.outLoginMess.overstaffed+'')
                /*测试数据*/  // this.$http.get('/stationmanage/outbound/bus/add?busPlanOutBoundLog.bus_plan_id=1565439&busPlanOutBoundLog.jin_zhan_shi_jian=2018-08-31+10%3A08%3A07&busPlanOutBoundLog.vehi_no=%E7%B2%A4A12345&busPlanOutBoundLog.dao_lu_yun_shu_zheng_hao=&busPlanOutBoundLog.zuo_wei=&busPlanOutBoundLog.zhuang_bei_deng_ji=&busPlanOutBoundLog.ji_shu_deng_ji=&busPlanOutBoundLog.shen_yan_you_xiao_qi=2099-12-31&busPlanOutBoundLog.ye_hu_ming_cheng=&busPlanOutBoundLog.biao_zhi_pai_hao_ma=&busPlanOutBoundLog.xian_lu_ming_cheng=%E5%8D%97%E7%B2%A4%E9%80%9A%E4%B8%93%E7%BA%BF&busPlanOutBoundLog.tu_jing_xian_lu=&busPlanOutBoundLog.pei_ke_zhan_dian=&busPlanOutBoundLog.ban_ci_hao=0003&busPlanOutBoundLog.fa_che_zhan=%E5%8D%97%E7%9B%9B%E5%AE%A2%E8%BF%90%E7%AB%99&busPlanOutBoundLog.zhong_dao_zhan=&busPlanOutBoundLog.ban_ci_zhong_lei=%E6%AD%A3%E7%8F%AD&busPlanOutBoundLog.fa_ban_shi_jian=2018-08-27+09%3A21%3A39&busPlanOutBoundLog.che_shang_yi_you_ren_shu=31&busPlanOutBoundLog.ben_zhan_ping_piao_ren_shu=1&busPlanOutBoundLog.ben_zhan_mian_piao_ren_shu=2&busPlanOutBoundLog.ben_zhan_mian_piao_er_tong=0&busPlanOutBoundLog.chu_zhan_zhong_ren_shu=32&busPlanOutBoundLog.an_jian_shi_fou_you_xiao=1&busPlanOutBoundLog.xing_shi_zheng_shi_fou_you_xiao=1&busPlanOutBoundLog.jia_shi_yuan_1=%E5%A7%93%E5%90%8D1&busPlanOutBoundLog.chong_ye_zhi_ge_zheng_hao_1=9987&busPlanOutBoundLog.jia_shi_zheng_shi_fou_you_xiao_1=1&busPlanOutBoundLog.jia_shi_yuan_2=&busPlanOutBoundLog.chong_ye_zhi_ge_zheng_hao_2=&busPlanOutBoundLog.jia_shi_zheng_shi_fou_you_xiao_2=1&busPlanOutBoundLog.jia_shi_yuan_3=&busPlanOutBoundLog.chong_ye_zhi_ge_zheng_hao_3=&busPlanOutBoundLog.jia_shi_zheng_shi_fou_you_xiao_3=1&busPlanOutBoundLog.shi_fou_ji_hao_an_quan_dai=1&busPlanOutBoundLog.shi_fou_pei_zai_wei_xian_pin=%E5%90%A6&busPlanOutBoundLog.bei_zhu=&busPlanOutBoundLog.shi_fou_chao_yuan=0')
                    .then(target => {
                        console.log(target);
                        var tag = target.data;
                        if(tag[0] === -1){
                            this.$message({
                                message:tag[1],
                                type: 'error'
                            });
                        }else if(tag[0] === 0){
                            this.$message({
                                message:tag[1],
                                type: 'success'
                            });
                        }
                    });
            },
            dataLists(){//加载默认数据列表
                var that = this;
                var checkDate = that.formDate.date;
                this.postRequest("/stationmanage/outbound/bus/buslist",{
                    filterRules: JSON.stringify([
                        {"field":"bus_date","op":"eq","value":checkDate === "" ? that.dateToString(new Date) : that.dateToString(checkDate)},
                        // {"field":"bus_date","op":"eq","value":"2018-08-27"},/*测试数据*/
                    ]),sort: 'bus_bill_print_time',order: 'desc',page: this.page.currentPage,rows: '10'
                }).then(target =>{
                    // console.log("********");
                    // console.log(target);
                    // console.log("********");
                    var tag = target.data.list;
                    //页码大小
                    this.page.pageSize = target.data.pageSize;
                    //页码数
                    this.page.pageNumber = target.data.pageNumber;
                    //总页数
                    this.page.total = target.data.totalRow;
                    for(var i=0;i<tag.length;i++){
                        if(tag[i].is_ot){
                            tag[i].is_ot = '加';
                        }else{tag[i].is_ot = '';}
                    }
                    this.carData = tag;
                });
            },
            rowChange(val){
                console.log(val);
                this.page.currentPage = val;
                this.dataLists();
            },
        },
        computed:{},
        watch:{//监听车牌号的变化
            cardCodeTips(){this.getCardMess();},
            driveNames1(){
                this.getDriverList();
                this.$http
                    .post("/sch/data/driver/listWithSpell").then(target => {
                    var tag = target.data;
                    // console.log(tag);
                    for(var i=0;i<tag.length;i++){
                        if(this.driveNames1 === tag[i].name){
                            this.newEmployment1 = tag[i].job_cardno;
                        }
                    }
                })
            },
            driveNames2(){
                this.getDriverList();
                this.$http
                    .post("/sch/data/driver/listWithSpell").then(target => {
                    var tag = target.data;
                    // console.log(tag);
                    for(var i=0;i<tag.length;i++){
                        if(this.driveNames2 === tag[i].name){
                            this.newEmployment2 = tag[i].job_cardno;
                        }
                    }
                })
            },
            driveNames3(){
                this.getDriverList();
                this.$http
                    .post("/sch/data/driver/listWithSpell").then(target => {
                    var tag = target.data;
                    // console.log(tag);
                    for(var i=0;i<tag.length;i++){
                        if(this.driveNames3 === tag[i].name){
                            this.newEmployment3 = tag[i].job_cardno;
                        }
                    }
                })
            },
        },
        mounted() {
            this.searchCode();
            this.getDriverList();
            this.$emit("sendActive","3-1");
            this.dataLists();
            this.restaurants = this.loadAll();
            this.cardRestaurants = this.loadAll();
            this.carArr = this.loadAll();
            // this.searchBusList();
            /*文字超过4个*/
            $(function() {
                $('.car-items .el-form-item__label').each(function() { //遍历相同样式名的元素
                    var h = $(this).html().length;
                    if(h>4){
                        this.style.lineHeight = "20px"
                    }
                });
            });
        }
    }



</script>
<style scoped src="../../assets/css/inoutManage/outboundLogin.css"></style>
